// pages/zhufu/zhufu.js
const app = getApp()
var util = require('../../utils/util.js');

Page({

  /**
   * 页面的初始数据
   */
  data: {
    relation:1,
    festival:1,
    name:'',
    userName:'',
    userHeader:'',
    options: null,
    list:[],

    chooseZhuFu:''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    that.setData({
      options:options
    })
    wx.request({
      url: app.globalData.url + 'get_all_wish/r/' + options.relation + '/f/' + options.festival,
      success:function(res){
        // console.log(res)
        that.setData({
          list:res.data.data,
          name: options.name,
          userName: options.userName,
          userHeader: options.avatarUrl
        })
      }
    })
  },

  //
  radioChange:function(e){
    this.setData({
      chooseZhuFu: e.detail.value
    })
    // console.log(e.detail.value)
  },

  //
  sure:function(){
    wx.redirectTo({
      url: 'write?name=' + this.data.name + '&userName=' + this.data.userName + '&Rezhufu=' + this.data.chooseZhuFu + '&relation=' + this.data.options.relation + '&festival=' + this.data.options.festival + '&content=' + '&avatarUrl=' + this.data.userHeader,
    })
  }
})